import smtplib
from email.mime.text import MIMEText
from email.header import Header

    # '3247649133@qq.com'
from_addr='zzt_bir_notice@163.com'
to_addr='946941094@qq.com'
passwd='SBMQIUBCSOUJPKSH'


def sendmes(name,time):
    message=""
    for i in range(len(name)):
        message+=name[i]+" 准备生日啦，记得去庆祝人地"+"时间系"+time[i][0:2]+"月"+time[i][2:]+"日"
    
    if message!=None:
        print(message)
        msg=MIMEText(message,'plain','utf-8')
        msg['From']=Header(from_addr)
        msg['To']=Header(to_addr)
        msg['Subject']=Header('有人最近生日啦！')

        mail = smtplib.SMTP_SSL('smtp.163.com',465)
        mail.login(from_addr,passwd)
        mail.sendmail(from_addr,to_addr,msg.as_string())
        mail.quit()
    else :
        print("null")